package 取石子游戏;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        if (n % (k + 1) > 0) {
            System.out.println(1);
        } else {
            System.out.println(2);
        }
    }
}
